<?php

  /*
    Test content feed script. This script (when used with the described database)
    will return JavaScript code to display the feed in a browser. It will display
    a standard <html> table that contains external links to a fictional site,
    http://www.joe-bloggs-news.com.

    Use this PHP script and modify it to your hearts content!
  */

  header("Content-Type: text/javascript");

  $db_server = "localhost";
  $db_db = "content";
  $db_user = "admin";
  $db_pass = "password";

  @$sConn = mysql_connect($db_server, $db_user, $db_pass);
  @$dConn = mysql_select_db($db_db, $sConn);

  if(!$sConn || !$dConn)
  {
    ?>
      document.write("Couldn't load news");
    <?php
  }

  ?>
      document.write("<table width='300' cellspacing='0' cellpadding='0'>");

      document.write("<tr>");
      document.write("  <td bgcolor='#FF9A00' height='23'>");
      document.write("  <p style='margin-left:5; margin-right:5'>");
      document.write("    <font face='verdana' size='2' color='#FFFFFF'><b>Joe Bloggs News</b></font>");
      document.write("  </td>");
      document.write("<tr>");

  <?php

  $nResult = mysql_query("select articleId, title from articles order by articleId desc limit 10");


  while($nRow = mysql_fetch_array($nResult))
  {
    ?>
      document.write('<tr>');      
      document.write('  <td bgcolor="#FFEFCE" height="25">');
      document.write('  <p style="margin-left:5; margin-right:5">');
      document.write('    <a target="_blank" href="http://www.joe-bloggs-news.com/news.php?newsId=<?=$nRow["articleId"]?>"><font face="verdana" size="2" color="black"><?=addslashes($nRow["title"])?></font></a>');
      document.write('  </td>');      
      document.write('<tr>');

    <?php
  }

  ?>

      document.write("<tr>");
      document.write("  <td bgcolor='#D4D298' height='23'>");
      document.write("  <p style='margin-left:5; margin-right:5'>");
      document.write("    <a target='_blank' href='http://www.joe-bloggs-news.com'><font face='verdana' size='1' color='#000000'><b>Visit Joe-Bloggs-News.com for more news</b></font>");
      document.write("  </td>");
      document.write("<tr>");

      document.write("</table>");
